﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using Maticsoft.DBUtility;

namespace ElingOA6_DSJCJ.DAL
{
    /// <summary>
    /// 友情连接 数据类
    /// </summary>
    public class LinkType
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        public LinkType()
        {
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2013-09-09</date>
        /// </summary>
        public DataSet GetAllList(string entityNo)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select FLinkTypeCD,FEntityNo,FLinkTypeName,FLinkProp ");
            strSql.Append(" FROM t_LinkType ");
            strSql.Append(" where FEntityNo=@FEntityNo ");
            SqlParameter[] parameters = {
					new SqlParameter("@FEntityNo", SqlDbType.NVarChar,12)			};
            parameters[0].Value = entityNo;
            return DbHelperSQL.Query(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 得到一个对象实体
        /// <creator>wangl</creator>
        /// <date>2013-09-09</date>
        /// </summary>
        public Model.LinkType DataRowToModel(DataRow row)
        {
            Model.LinkType model = new Model.LinkType();
            if (row != null)
            {
                if (row["FLinkTypeCD"] != null)
                {
                    model.FLinkTypeCD = row["FLinkTypeCD"].ToString();
                }
                if (row["FEntityNo"] != null)
                {
                    model.FEntityNo = row["FEntityNo"].ToString();
                }
                if (row["FLinkTypeName"] != null)
                {
                    model.FLinkTypeName = row["FLinkTypeName"].ToString();
                }
                if (row["FLinkProp"] != null)
                {
                    model.FLinkProp = row["FLinkProp"].ToString();
                }
            }
            return model;
        }
    }
}
